<!--
 * @Author: xuxu12138 1718324422@qq.com
 * @Date: 2023-11-28 09:20:08
 * @LastEditors: xuxu12138 1718324422@qq.com
 * @LastEditTime: 2023-12-13 13:04:57
 * @FilePath: /massage2_a510/src/components/Auestionnaried/Auestionnaried.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="core">
    <!-- 第零页 -->
    <div class="wenjuan" v-for="(item, index) in data" :key="item.id">
      <div class="danxuan" v-if="item.questionType == 1">
        <div class="timu">
          {{ index + 1 }}. {{ item.questionContent }}? (单选)
        </div>
        <div class="xuanxiang">
          <el-radio-group v-model="item.answerValue">
            <el-radio
              disabled
              style="margin-bottom: 2rem"
              v-for="items in item.options"
              :key="items.id"
              :label="items"
            >
              {{ items.optionContent }}</el-radio
            >
          </el-radio-group>
        </div>
      </div>
      <div class="duoxuan" v-else-if="item.questionType == 2">
        <div class="timu">
          {{ index + 1 }}. {{ item.questionContent }}？ (可多选)
        </div>
        <div class="xuanxiang">
          <el-checkbox-group disabled v-model="item.answerValue">
            <el-checkbox
              style="margin-bottom: 2rem"
              v-for="items in item.options"
              :key="items.id"
              :label="items"
              >{{ items.optionContent }}</el-checkbox
            >
          </el-checkbox-group>
        </div>
      </div>
      <div class="tiankong" v-else>
        <div class="timu">
          {{ index + 1 }}. {{ item.questionContent }}？ (填空)
        </div>
        <el-input
          disabled
          type="text"
          v-model="item.answerValue"
        ></el-input>
      </div>
    </div>
    <!-- 第零页 -->
  </div>
</template>

<script>
export default {
  data() {
    return {
      selectIndex: 0,
      data: [],
      preview: {},
      //单选
     
      arr: [],
    };
  },

  watch: {
    questionnaireSpecificVos: {
      handler: function (newVal) {
        console.log(newVal);
        // 数组发生变化时的处理逻辑
        this.data = newVal;
      },
      deep: true, // 指定深度监听数组
    },
  },
  props: {
    questionnaireSpecificVos: {
      type: Array,
      default: [],
    },
  },
  created() {
    this.data = this.questionnaireSpecificVos;
  },
  methods: {},
};
</script>

<style lang="less" scoped>
.title {
  color: black;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
}
.wenjuan {
  margin-top: 24px;

  .timu {
    color: black;
    font-size: 16px;
  }
  .xuanxiang {
    display: flex;
    flex-wrap: wrap;
    margin-top: 24px;
  }
}
.footer {
  display: flex;
  justify-content: center;
}
/deep/ .el-input__inner {
  margin-top: 24px;
}

/deep/ .el-checkbox .is-checked {
  background-color: #fff;
}
.closePage {
  cursor: pointer;
  width: 100px;
  height: 30px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #1791d5;
  margin-left: 180px;
  margin-top: 20px;
}
.detail {
  .detail_title {
    font-size: 18px;
    font-weight: 600;
    margin-top: 10px;
  }
  .detail_desc {
    display: flex;
    flex-wrap: wrap;
    font-size: 18px;
    font-weight: 600;
    div {
      margin-right: 20px;
      margin-top: 10px;
    }
  }
}
</style>
